<div class='right-cont right-cont-less' ng-controller='MoneyDeductList'>
	<div class='title'>资金分配列表<i class='fa fa-spinner fa-spin' ng-if='loading'></i></div>
	<div class='content'>
        <ul class='nav nav-tabs nav-tabs-a'>
            <li class='active'>
                <a data-target='#list-all' data-toggle='tab'>全部用户</a>
            </li>
            <li><a data-target='#list-expand' data-toggle='tab'>直属教练</a></li>
            
            <div class='box-search-key-date'>
                <div class='input-group input-group-date'>
                    <input type='text' class='form-control input-date' placeholder='起始时间'
                        ng-model='dateStart'>
                    <span class='input-group-addon'>至</span>
                    <input type='text' class='form-control input-date' placeholder='结束时间'
                        ng-model='dateEnd'>
                </div>
                <input type='text' class='form-control input-keyword' placeholder='关键词'
                    ng-model='keyword'>
                <button class='btn btn-primary' ng-click='load_data(1)'>搜索</button>
                <button class='btn btn-success' ng-click='out_excel()'>导出</button>
                <button class='btn btn-warning' data-toggle='modal' data-target='.modal.bargain-total'>合计</button>
            </div>
        </ul>

        <div class='tab-content tab-content-a'>
            <div class='tab-pane fade in active' id='list-all'>
                <table class='table table-list'>
                    <tr>
                        <td>订单ID <span class='fa fa-sort'></span></td>
                        <td>用户ID <span class='fa fa-sort'></span></td>
                        <td>微信昵称<span class='fa fa-sort'></span></td>
                        <td>真实姓名<span class='fa fa-sort'></span></td>
                        <td>用户角色<span class='fa fa-sort'></span></td>
                        <td>交易类型<span class='fa fa-sort'></span></td>
                        <td>交易时间<span class='fa fa-sort'></span></td>
                        <td>交易金额<span class='fa fa-sort'></span></td>
                        <td>获得金额<span class='fa fa-sort'></span></td>
                        <td>分配比例<span class='fa fa-sort'></span></td>
                        <td>操作<span class='fa fa-sort'></span></td>
                    </tr>
                    <tr ng-repeat='item in list'>
                        <td>{{item.money_id || '未知'}}</td>
                        <td>{{item.user_id || '未知'}}</td>
                        <td>{{item.nickname || '未知'}}</td>
                        <td>{{item.truename || '未知'}}</td>
                        <td>{{item.role_text || '未知'}}</td>
                        <td>{{item.goods_type_text || '未知'}}</td>
                        <td>{{item.create_date || 0}}</td>
                        <td>{{item.amount || 0}}</td>
                        <td>{{item.get_amount || 0}}</td>
                        <td>{{item.percent || 0}}</td>
                        <td>
                            <button class='btn btn-primary btn-xs btn-w-xs' 
                                ng-click='detail(item, item.get_type, item.get_relate_id)'>
                                详情
                            </button>
                            <button class='btn btn-success btn-xs btn-w-xs' 
                                ng-click='get_child_list(item)'>
                                下级
                            </button>
                        </td>
                    </tr>
                </table>
            </div>
            <div class='tab-pane fade' id='list-expand'>
                <table class='table table-list'>
                    <tr>
                        <td>订单ID <span class='fa fa-sort'></span></td>
                        <td>微信昵称<span class='fa fa-sort'></span></td>
                        <td>真实姓名<span class='fa fa-sort'></span></td>
                        <td>用户角色<span class='fa fa-sort'></span></td>
                        <td>交易类型<span class='fa fa-sort'></span></td>
                        <td>交易时间<span class='fa fa-sort'></span></td>
                        <td>交易金额<span class='fa fa-sort'></span></td>
                        <td>获得金额<span class='fa fa-sort'></span></td>
                        <td>分配比例<span class='fa fa-sort'></span></td>
                        <td>操作<span class='fa fa-sort'></span></td>
                    </tr>
                    <tr ng-repeat='item in list'>
                        <td>{{item.money_id || '未知'}}</td>
                        <td>{{item.nickname || '未知'}}</td>
                        <td>{{item.truename || '未知'}}</td>
                        <td>{{item.role_text || '未知'}}</td>
                        <td>{{item.goods_type_text || '未知'}}</td>
                        <td>{{item.create_date || 0}}</td>
                        <td>{{item.amount || 0}}</td>
                        <td>{{item.get_amount || 0}}</td>
                        <td>{{item.percent || 0}}</td>
                        <td>
                            <button class='btn btn-primary btn-xs btn-w-xs' 
                                ng-click='detail(item, item.get_type, item.get_relate_id)'>
                                详情
                            </button>
                        </td>
                    </tr>
                </table>
            </div>
            <div class='box-page' ng-bind-html='pageHtml'></div>
        </div>
	</div>
	
	<!--交易详情模态窗-->
	<div class='modal fade bargain-detail'>
        <div class='modal-dialog'>
            <div class='modal-content'> 
                <div class='modal-header'>
                    交易详情
                    <a class='close' data-dismiss='modal'>&times;</a>
                </div>
                <div class='modal-body'>
                    <table class='table-info'>
                        <tr>
                            <td>用户昵称:</td>
                            <td>{{nItemInfo.nickname || '未知'}}</td>
                            <td>真实姓名:</td>
                            <td>{{nItemInfo.truename || '未知'}}</td>
                            <td>用户角色:</td>
                            <td>{{nItemInfo.role_text || '未知'}}</td>
                        </tr>
                        <tr>
                            <td>交易金额:</td>
                            <td>{{nItemInfo.amount || '未知'}}</td>
                            <td>平台利润:</td>
                            <td>{{nItemInfo.profit || 0}}</td>
                            <td>用户利润:</td>
                            <td>{{nItemInfo.get_amount || '未知'}}</td>
                        </tr>
                        <tr>
                            <td>交易单号:</td>
                            <td colspan='3'>{{nItemInfo.trade_no || '未知'}}</td>
                            <td>交易时间:</td>
                            <td>{{nItemInfo.create_date || 0}}</td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
    </div>

    <!-- 合计信息模态窗 -->
    <div class='modal fade bargain-total'>
        <div class='modal-dialog'>
            <div class='modal-content'> 
                <div class='modal-header'>
                    合计信息
                    <a class='close' data-dismiss='modal'>&times;</a>
                </div>
                <div class='modal-body'>
                    <table class='table-info'>
                        <tr>
                            <td>分配笔数:</td>
                            <td>{{total.count || 0}}笔</td>
                            <td>交易金额:</td>
                            <td>{{total.amount || 0}}元</td>
                            <td>获得金额:</td>
                            <td>{{total.get_amount || 0}}元</td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>